<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="/book0419/book/queryByPage?curPageKey=${pageUtils1Key.curPage}&pageSizeKey=${pageUtils1Key.pageSize}">
    <input type="text" name="bookNames" placeholder="请输入图书名称"/>
    <input type="text" name="minPriceKey" placeholder="请输入图书最小价格"/>
    <input type="text" name="maxPriceKey" placeholder="请输入图书最大价格"/>
    <input type="submit" value="查询">
</form>
<form action="/book0419/book/dropBatch" id="addAndDrop">
    <input type="button" value="新增" id="add"/>
    <input type="submit" value="批量删除"/>
    <table>
        <tr>
            <td><input type="checkbox"></td>
            <td>序号</td>
            <td>图书名称</td>
            <td>图片价格</td>
            <td>图书作者</td>
            <td>图书图片</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${pageUtils1Key.data}" var="book" varStatus="vs">
            <tr>
                <td><input type="checkbox" name="id" value="${book.id}"/></td>
                <td>${vs.count}</td>
                <td>${book.bookName}</td>
                <td>${book.price}</td>
                <td>${book.writer}</td>
                <td><img style="width: 50px; height: 50px;" src="/upload/${book.bookPicture}"></td>
                <td>
                    <a href="/book0419/book/queryById?id=${book.id}">编辑</a>
                    <a href="/book0419/book/drop?id=${book.id}">删除</a>
                    <a href="/book0419/book/download?bookPicture=${book.bookPicture}">下载图片</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="7">
                当前页:${pageUtils1Key.curPage}/${pageUtils1Key.totalPages}&nbsp;&nbsp;
                总记录数：${pageUtils1Key.totalCount}
                <a href="/book0419/book/queryByPage?curPageKey=${pageUtils1Key.curPage-1}&pageSizeKey=${pageUtils1Key.pageSize}&bookNames=${bookNames2}&minPriceKey=${minPriceKey2}&maxPriceKey=${maxPriceKey2}">上一页</a>&nbsp;&nbsp;
                <a href="/book0419/book/queryByPage?curPageKey=${pageUtils1Key.curPage+1}&pageSizeKey=${pageUtils1Key.pageSize}&bookNames=${bookNames2}&minPriceKey=${minPriceKey2}&maxPriceKey=${maxPriceKey2}">上一页</a>&nbsp;&nbsp;
            </td>
        </tr>
    </table>
</form>
<script>
    let addObj = document.querySelector("#add");
    let addAndDrop = document.querySelector("#addAndDrop");
    addObj.addEventListener('click',function (){
        addAndDrop.action="/book0419/book/saves";
        addAndDrop.submit()
    })
</script>
</body>
</html>
